Implementing Oauth 2.0 From Scratch